package com.pai4j.user.controller;

import com.pai4j.common.bean.PAIResponseBean;
import com.pai4j.common.bean.PAIResponseBeanUtil;
import com.pai4j.domain.vo.request.chat.UpdateUserChatSettingRequestVO;
import com.pai4j.domain.vo.response.chat.UserChatSettingResponseVO;
import com.pai4j.remote.user.UserChatSettingClient;
import com.pai4j.user.service.chat.UserChatSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserChatSettingController implements UserChatSettingClient {

    @Autowired
    private UserChatSettingService userChatSettingService;
    /**
     * 更新用户聊天设置
     *
     * @param request 更新用户聊天设置请求参数对象，包含需要更新的设置信息
     * @return PAIResponseBean<Boolean> 响应结果，包含更新操作是否成功的布尔值
     */
    @Override
    public PAIResponseBean<Boolean> update(@RequestBody UpdateUserChatSettingRequestVO request) {
        return PAIResponseBeanUtil.success(userChatSettingService.update(request));
    }

    /**
     * 获取用户聊天设置
     *
     * @param ownerAccount 用户账号，表示设置的所有者
     * @param peerAccount 对方账号，表示聊天的对方
     * @return PAIResponseBean<UserChatSettingResponseVO> 响应结果，包含用户聊天设置的详细信息
     */
    @Override
    public PAIResponseBean<UserChatSettingResponseVO> get(@PathVariable String ownerAccount, @PathVariable String peerAccount) {
        return PAIResponseBeanUtil.success(userChatSettingService.get(ownerAccount, peerAccount));
    }

}
